Re: [SQL] Relating 1 table to another.

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [SQL] Relating 1 table to another.
Дата
Msg-id l03130303b34debfbb5b1@[147.233.159.109]
обсуждение исходный текст
Ответ на Re: [SQL] Relating 1 table to another.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
At 19:47 +0300 on 25/04/1999, Tom Lane wrote:


>
> This is where you need table aliases (AS clauses).  You do it like this:
>
> select project.id, project.name, p1.name, p2.name
> from project, people as p1, people as p2 where
> project.mainpersonid = p1.id and project.standbypersonid = p2.id;

No, AS is for field aliasing, not table aliasing.

The proper syntax is

SELECT project.id, project.name, p1.name, p2.name
FROM project, people p1, people p2
WHERE project.mainpersonid = p1.id AND project.standbypersonid = p2.id;

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




В списке pgsql-sql по дате отправления:

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] Finding the "most recent" rows
Следующее
От: José Soares
Дата:
Сообщение: Re: [SQL] LIMIT